<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Matrix207's Blog">
<meta property="og:url" content="http://yoursite.com/page/17/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Matrix207's Blog">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-linux-device-driver" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/01/06/linux-device-driver/" class="article-date">
  <time datetime="2013-01-05T16:00:00.000Z" itemprop="datePublished">2013-01-06</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/01/06/linux-device-driver/">linux device driver</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>####[转载]Linux驱动开发学习的一些必要步骤  </p>
<p><em>1.</em> 学会写简单的makefile</p>
<p><em>2.</em> 编一应用程序，可以用makefile跑起来</p>
<p><em>3.</em> 学会写驱动的makefile</p>
<p><em>4.</em> 写一简单char驱动，makefile编译通过，可以insmod， lsmod， rmmod.<br>    在驱动的init函数里打印hello world， insmod后应该能够通过dmesg看到输出。  </p>
<p><em>5.</em> 写一完整驱动， 加上read， write， ioctl， polling等各种函数的驱动实现。<br>    在ioctl里完成从用户空间向内核空间传递结构体的实现。  </p>
<p><em>6.</em> 写一block驱动， 加上read，write，ioctl，poll等各种函数实现。</p>
<p><em>7.</em> 简单学习下内存管理， 这个是最难的，明白各种memory alloc的函数实现细节。<br>    这是Linux开发的基本功。  </p>
<p><em>8.</em> 学习锁机制的应用，这个不是最难的但是最容易犯错的，涉及到很多同步和并发的问题。</p>
<p><em>9.</em> 看内核中实际应用的驱动代码。<br>   你会发现最基本的你已经知道了，大的框架都是一样的，无非是read，write，ioctl等函数的实现，<br>   但里面包含了很多很多细小的实现细节是之前不知道的。<br>   这时候就要考虑到很多别的问题而不仅仅是基本功能的实现。<br>   推荐您看2.6.20中integrated的一个驱动kvm，记得是在driver/lguest下，很好玩的，就是Linux下的虚拟机驱动，代码不长，但功能强大。<br>   有能力的可以自己写一操作系统按照要求做成磁盘镜像加载到虚拟机中，然后客户机可以有自己的4G虚拟地址空间。</p>
<p><em>10</em>. 看完驱动欢迎您进入Linux kernel学习中来。</p>
<p>最简单的方法，跟着ldd（Linux devive driver）做一遍</p>
<p>来源:<br><a href="http://linux.chinaitlab.com/driver/745132.html" target="_blank" rel="external">http://linux.chinaitlab.com/driver/745132.html</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/01/06/linux-device-driver/" data-id="ciqqpe1fw001snmpv7208r04t" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/driver/">driver</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-vim-english-dict" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/01/06/vim-english-dict/" class="article-date">
  <time datetime="2013-01-05T16:00:00.000Z" itemprop="datePublished">2013-01-06</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/01/06/vim-english-dict/">vim english dict</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="vim英文字典"><a href="#vim英文字典" class="headerlink" title="vim英文字典"></a>vim英文字典</h4><ul>
<li><p><em>下载字典</em><br> 地址:<a href="http://www.vim.org/scripts/script.php?script_id=195" target="_blank" rel="external">http://www.vim.org/scripts/script.php?script_id=195</a></p>
</li>
<li><p><em>解压缩所需字典文件</em><br> <code>tar xvf ~/Downloads/engspchk.tar.gz CVIMSYN/engspchk.dict</code>  </p>
</li>
<li><p><em>使用vim整理成字典文件</em><br> <code>vim CVIMSYN/engspchk.dict</code><br> 删除前面三行: <code>gg3dd</code><br> 删除行首GoodWord单词: <code>:%s/^GoodWord\t//g</code><br> 整理成每个单词占一行: <code>:%s/\t/
/g</code><br> 删除最后一行: <code>Gdd</code><br> 排序: <code>:sort</code>  </p>
</li>
<li><p><em>拷贝字典文件到指定目录</em><br> <code>mkdir /usr/share/vim/vim73/dict</code><br> <code>cp CVIMSYN/engspchk.dict /usr/share/vim/vim73/dict/english.dict</code>  </p>
</li>
<li><p><em>设置.vimrc文件</em><br> <code>setlocal dictionary+=$VIMRUNTIME/dict/english.dict</code></p>
</li>
<li><p><em>英文单词自动补全快捷键</em><br> Ctrl+X Ctrl+K</p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/01/06/vim-english-dict/" data-id="ciqqpe1g2001vnmpv1bxykqmz" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vim/">vim</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-linux-common-command" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/01/05/linux-common-command/" class="article-date">
  <time datetime="2013-01-04T16:00:00.000Z" itemprop="datePublished">2013-01-05</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/01/05/linux-common-command/">Linux frequently used commands</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="shell-terminal"><a href="#shell-terminal" class="headerlink" title="shell terminal"></a>shell terminal</h4><ul>
<li><p><code>!!</code> the previous command (Actually the latest command list with command <code>history</code>)<br><code>!-1</code> is equal to <code>!!</code><br><code>!-2</code> is second command list with command <code>history</code><br><code>!^</code>  first parameter<br><code>!:1</code> first parameter<br><code>!:n</code> the n parameter<br><code>!:$</code> last parameter  </p>
</li>
<li><p><code>C-A/E</code> <strong>jump to the head/end position</strong><br><code>C-U/K</code> trim to head/tail<br><code>C-P/N</code> <strong>prev/next command</strong><br><code>C-R</code>   <strong>history command</strong><br><code>C--</code>   zoom in<br><code>C-L</code>   clear screen, same as <code>clear</code><br><code>C-C</code>   cancel current command<br><code>C-&amp;</code>   cancel modify<br><code>C-T</code>   switch<br><code>C-Y</code>   paste<br><code>C-W</code>   <strong>delete a word</strong><br>Below operation need to unset Enable menu access keys option of terminal.<br><code>C-f/b</code> move cursor forward/backward a character<br><code>M-f/b</code> move cursor forward/backward a word<br><code>C-d</code>   delete a character forward<br><code>C-h</code>   delete a character backward<br><code>M-d</code>   delete a word froward<br><code>C-M-h</code> <strong>delete a word backward, the word was splited by any special symbols</strong><br><code>C-w</code>   <strong>delete a word backward, the word was splited by space symbol only</strong><br><code>C-]</code>   search character forward<br><code>C-M-]</code> <strong>search character backward</strong>  </p>
</li>
<li><p><code>&lt;alt&gt;+.</code> get the last parameter of previous command</p>
</li>
</ul>
<h4 id="common-command"><a href="#common-command" class="headerlink" title="common command"></a>common command</h4><ul>
<li><p><code>cd -</code> switch to last dir<br><code>cd</code> switch to user home dir  </p>
</li>
<li><p><code>cp filename{,.bak}</code> a fast method to bakup a file</p>
</li>
<li><p><code>mv filename{.bak,}</code> a fast method to cut the suffix</p>
</li>
<li><p><code>time command</code> count the elapsed time</p>
</li>
<li><p><code>mount -t cifs -o username=***,passwd=*** //ip/path /mnt/test</code><br>mount network sharing dir<br><code>mount -t iso9660 /mnt/iso/FC17-DVD.iso /mnt/dvd</code><br>use for mounting ISO file<br><code>mount --bind /root/project/myprj /root/x86_64_build/source</code><br>mount a dir to another, use for across-compilation mostly<br><code>mount -t tmpfs -o size=1024m tmpfs /mnt/ram</code><br>mount memory as a w/r dir (use for high speed I/O operation, and disk space not enough)  </p>
</li>
<li><p><code>tar xvf example.tar.gz -C /root/test</code> extract files to specific dir<br><code>tar tvf example.tar.gz</code> list the contents of an archive<br><code>tar -zcvf - stuff | openssl des3 -salt -k *** | dd of=stuff.des3</code> encryption<br><code>tar cvfz chenxu.tar.gz dir --exclude dir/dir1 --exclude dir/dir2/dir3</code><br><code>tar -xvf 1425279081.tar.gz var/log/message</code> get only one file<br><code>dd if=stuff.des3 | openssl des3 -d -k *** | tar zxf -</code> decryption<br><code>7z a -t7z -ptestpsw123 mytest.7z -r testfolder/*</code> zip folder and encrypt it by 7z  </p>
</li>
<li><p><code>getconf LONG_BIT</code>           print the operator system bits<br><code>grep -c &quot;lm&quot; /proc/cpuinfo</code> if output is not 0, it is 64bit cpu  </p>
</li>
<li><p><code>du -sh</code><br><code>du -s * |sort -n |tail</code></p>
</li>
<li><p><code>free   bg   kill pid    killall proc    chmod 777 (r:4,w:2,x:1)(user,group,all)</code></p>
</li>
<li><p><code>find / -name &quot;***&quot;</code><br><code>find path \( -name &quot;*.h&quot; -or -name &quot;*.c&quot; \) -exec grep -in &quot;***&quot; {} \;</code><br><code>find ./ -name &quot;*.*&quot; -exec ls -l {} \; |awk &#39;{print $5,$9}&#39; |sort -n |tail</code> find the 10 biggest files.<br><code>find / -type d -name &quot;gedit&quot;</code> search direactorys<br><code>find . \( -path ./.git -o -path dir2 \) -prune -o -type d -print</code> search sub-dir, except .git and dir2<br><code>find /usr/include/ -path /usr/include/boost -prune -o -name &#39;*.h&#39; -print &gt;1.txt</code><br><code>find . -name &quot;.svn&quot; | xargs rm -rf</code> find .svn folder in current directory, and remove it.<br><code>find ./ \( -name &quot;*.h&quot; -or -name &quot;*.c&quot; \) -exec wc -l {} \; | awk &#39;{s+=$1} END {print s}&#39;</code> count lines of specify files<br><code>find ./ \( -name &quot;*.h&quot; -or -name &quot;*.c&quot; \) | xargs wc -l | tail -n 1</code> count lines of specify files<br>the upon two command can count lines of specify files, but what is the<br>difference of them, look this<br><a href="http://stackoverflow.com/questions/13651212/unix-difference-xargs-and-exec" target="_blank" rel="external">Difference xargs and exec</a><br>you will find the answer.<br><code>find ./ -path ./perl -prune -o -name &quot;*.so&quot; -exec cp {} ../net-snmp-5.4.4-sdk/lib/ \;</code><br>copy files which search by find, search exclude ./perl path<br><code>find /usr -size +100M</code>  find file size larger than 100M<br><code>find /home -mtime +120</code><br><code>find /var \! -atime -90</code><br><code>find &lt;dir&gt; -executable -type f</code> only find executable files  </p>
</li>
<li><p><code>grep -r &quot;abc&quot; /root/source</code><br><code>grep -r --include &quot;*.h&quot; &quot;date&quot; path</code><br><code>grep -m 1 &quot;model name&quot; /proc/cpuinfo</code> only display the first match line<br><code>grep -i -E &quot;abc|123&quot;</code> match abc or 123, -i ignore, -E extended regular expression.<br><code>grep -r -l &quot;main&quot; .</code> search all files under each directory, -l files-with-match, -L files-withou-match<br><code>grep -w &quot;linux&quot; *.md</code> match word<br><code>grep -rl --include=*.{h,cpp} &quot;socket&quot; .</code> search socket only with <em>.h </em>.cpp files<br><code>grep --exclude-dir=&quot;_posts&quot; --exclude-dir=&quot;_site&quot;  -r &quot;Dennis&quot; ./</code>  exclude specify directory<br><code>grep -rni &#39;[^a-zA-Z]abc[^a-zA-Z]&#39; ./</code>  match like “tt.abc.1234”, not match like “ttabccd”</p>
</li>
<li><p><code>cut -d&quot;&quot; -f1</code><br>e.g:<br><code>[root@localhost ~]# sensors |grep &quot;Core &quot;</code><br>Core 0:       +30.0°C  (high = +76.0°C, crit = +100.0°C)<br>Core 1:       +37.0°C  (high = +76.0°C, crit = +100.0°C)<br><code>[root@localhost ~]# sensors |grep &quot;Core &quot; |cut -d&quot;+&quot; -f2 |cut -d&quot; &quot; -f1</code><br>30.0°C<br>37.0°C  </p>
</li>
<li><p><code>history|awk &#39;{print $2}&#39;|awk &#39;begin {FS=&quot;|&quot;} {print $1}&#39;|sort|uniq -c|sort -rn|head -10</code></p>
</li>
<li><p><code>ps aux | sort -nk +4 | tail</code><br><code>ps -eo pid,lstart,etime | grep 3208</code> view the start and running time of specify process.<br><code>ps axjf</code> print process tree<br><code>ps -ef</code> see every process<br><code>ps -eLf</code> get about thread info<br><code>ps -U root -u root u</code> see every process running as root<br><code>pgrep firefox</code> print the procee id of firefox  </p>
</li>
<li><p><code>uname -a</code></p>
</li>
<li><p><code>whereis cp</code><br><code>rpm -qf /usr/bin/cp</code><br><code>rpm -ivp ***.rpm</code>  </p>
</li>
<li><p><code>rpm -qpl packetname</code> list files<br><code>rpm -i --relocate</code> change install directory<br><code>rpm -qa |grep XXX</code> check whether XXX was installed<br><code>rpm -e $(rpm -qf $(which teamviewer))</code> remove software  </p>
</li>
<li><p><code>mkdir -p /test/dir1/dir2/dir3</code></p>
</li>
<li><p><code>ftp 192.168.1.102 2121</code><br><code>pwd</code> view remote directory<br><code>lcd</code> change to the local directory<br><code>!ls</code> list local files<br><code>put 1.jpg</code><br><code>get 2.jpg</code><br><code>mput *.jpg</code><br><code>mget *.jpg</code>download multiple files<br><code>bye</code>  </p>
</li>
<li><code>wget ftp://IP:PORT/* --ftp-user=xxx --ftp-password=xxx -r</code> support download<br>multiple files and directories, good to replace <code>ftp</code></li>
</ul>
<h4 id="awk-and-sed"><a href="#awk-and-sed" class="headerlink" title="awk and sed"></a>awk and sed</h4><ul>
<li><p>awk<br><code>awk FS&#39;&#39; &#39;condition1{operator1}condition2{operator2}...&#39; filename</code><br>NR:number row, NF:number field<br><code>awk &#39;NR==1{print $0}&#39;</code><br><code>arr=($(awk -F&#39;#&#39; &#39;{print $1,$2,$3,$4}&#39; $conf_file))</code><br><code>ps aux | awk &#39;NR==1{print $0}$3&gt;10{print $0}&#39;</code><br><code>awk -F&#39;&lt;|&gt;&#39; &#39;{if(NF&gt;3){print $2 &quot;:&quot; $3}}&#39; /tmp/test.xml</code> parse xml file<br><code>awk -F&#39;=&#39; &#39;/HWADDR/{print $2}&#39; /etc/sysconfig/network-scripts/ifcfg-eth0</code></p>
</li>
<li><p>sed<br><code>sed [options] &#39;command&#39; file(s)</code><br><code>sed [options] -f scriptfile file(s)</code><br><code>sed -i &#39;/&#39;$prj&#39;/{s/\(.*#.*#\)[0-9]\+/\1&#39;$rev_new&#39;/}&#39; $conf_file</code><br><code>sed -n 10,23p filepath</code> -n print the specific lines<br><code>sed &#39;N;s/\n/ /&#39; filepath</code> join two line into one<br><code>echo -e &quot;11\n22\n33\n&quot; | sed -n &#39;/22/{n;p}&#39;</code> print next line after match<br><code>sed &#39;:a;N;s/\n/ /;ba;&#39; file</code> join all lines  </p>
</li>
</ul>
<h4 id="git-and-svn"><a href="#git-and-svn" class="headerlink" title="git and svn"></a>git and svn</h4><ul>
<li><p>git<br><code>git clone url</code><br><code>git add .</code><br><code>git commit -m &quot;***&quot;</code><br><code>git commit file -m &quot;***&quot;</code><br><code>git push origin master</code><br><code>git status</code><br><code>git diff</code><br><code>git rm ***</code> remove file<br><code>git rm -r ***</code> remove directory<br><code>git pull</code><br><code>git mv *** ###</code><br><code>git remote -v</code> show remote repository info<br><code>git reset &lt;file&gt;</code> undo git add<br><code>git checkout HEAD /path/file</code> undo git rm on one file<br><code>git rm $(git ls-files --deleted)</code> undo git rm multiple files  </p>
</li>
<li><p>svn<br><code>svn list url</code><br><code>svn co url</code><br><code>svn status</code><br><code>svn update</code><br><code>svn info url</code><br><code>svn di</code><br><code>svn di -r ver1:ver2</code><br><code>svn di -r ver1:ver2 path</code><br><code>svn revert [-R] path</code><br><code>svn merge -r ver2:ver1 path</code><br><code>svn log -r ver1:ver2</code><br><code>svn log -l5</code> show 5 latest logs<br><code>svn add path</code><br><code>svn commit -m &quot;***&quot;</code><br><code>svn ci path -m &quot;***&quot;</code><br><code>ls ~/.subversion/auth/svn.simple</code> user information location  </p>
</li>
</ul>
<h4 id="network"><a href="#network" class="headerlink" title="network"></a>network</h4><ul>
<li><code>ip addr</code><br><code>cat /sys/class/net/eth{0,1}/address</code> display mac address<br><code>ip addr add 172.16.60.69/24 dev eth1</code>  </li>
<li><code>ifconfig eth0 down; ifconfig eth0 hw ether MAC_ADDR; ifconfig eth0 up</code> change MAC address<br><code>ifconfig eth2 192.168.1.102 netmask 255.255.255.0 up</code> add ip address for eth2<br><code>ifconfig eth2:1 192.168.1.23 netmask 255.255.255.0 up</code> add another ip for eth2<br><code>ifconfig eth0 mtu 6000</code> set MTU  </li>
<li><code>ping -I 192.16.4.23 192.16.4.70</code> set source address to specified interface address  </li>
<li><code>route add default gw 172.16.130.1 eth2</code><br><code>route del default gw 172.16.130.1 eth2</code><br><code>route add -host 192.168.168.110 dev eth0</code><br><code>route del -host 192.168.168.110 dev eth0</code><br><code>route add -net 172.16.130.0/24 gw 172.16.130.1 eth2</code><br><code>route del -net 172.16.0.0 netmask 255.255.0.0 dev eth0</code><br><code>ip route flush cache</code>  </li>
<li><code>python -m SimpleHTTPServer</code><br><code>python -m http.server</code> for windows  </li>
<li><code>ssh root@172.168.1.101</code>  </li>
<li><code>ssh -f -NC -D7070 user@shell.cjb.net</code> ssh tunnel<br><code>ssh -f -NC -D7070 user@216.194.70.6</code> ssh tunnel </li>
<li><code>scp abc.sh root@172.168.1.101:/root/test</code> upload file<br><code>scp root@172.168.1.101:/root/test/abc.sh /root/mytest</code> download file<br><code>sshpass -p passwd scp abc.sh root@172.168.1.101:/root/test</code></li>
<li><code>nmap ip</code><br><code>nmap 192.168.1.1 -p 8000</code>  check the port is open or not<br><code>nmap -v -sn 192.168.1.1/24</code><br><code>nmap -v -sn 192.168.1.1/24 |grep &#39;report&#39; |grep -v &#39;down&#39; |awk &#39;{print $NF}&#39;</code> scan local alive ip  </li>
<li><code>nc -z -w 1 IP PORT</code><br><code>nc -z -w 1 192.168.1.1 100</code><br><code>nc -z -w 1 -u 192.168.1.1 100</code><br><code>nc -z -w 1 192.168.1.100 1-65535</code> scan all ports from 1 to 65535  </li>
<li><code>lsof -i:111</code><br><code>netstat -apn | grep 111</code><br><code>iptables -L</code> list rules<br><code>iptables -L INPUT --line-numbers</code><br><code>iptables -A INPUT -p tcp --dport 111 -j DROP</code> forbid specific port<br><code>iptables -A OUTPUT -p tcp --dport 111 -j DROP</code><br><code>iptables -A INPUT -p tcp --dport 8024 -j ACCEPT</code> all rule, allow port 8024<br><code>iptables -I INPUT 5 -p tcp --dport 8024 -j ACCEPT</code> add rule to specify position(5)<br><code>iptables -D INPUT -p tcp --dport 8024 -j ACCEPT</code> delete rule<br><code>service iptables save</code><br><code>service iptables stop</code><br><code>service iptables start</code>  </li>
<li><code>curl ifconfig.me</code><br><code>curl ipinfo.io/IP_ADDRESS</code> get geographic location of an IP address  </li>
<li><code>geoiplookup IP_ADDRESS</code>  </li>
<li><code>dig domain</code>   <code>dig -x host</code></li>
<li><code>netstat -nlp</code> view service and listen ports<br><code>netstat -npt</code> view tcp connections<br><code>netstat -s</code> display networking statistics  </li>
<li><code>wget url</code> download file<br><code>wget -m -p -np -k -E http://site/path/</code> mirror the site<br><code>wget -A pdf,jpg -m -p -np -k -E http://site/path/</code> only download pdf and jpg file<br><code>wget url_file -O new_name.file</code> rename  </li>
<li><code>tcpdump -D</code> list available device(run as root)<br><code>tcpdump -i p4p1 host 172.16.130.88 and port 80 -n</code> use specify interface “p4p1”<br><code>tcpdump -i p4p1 host 172.16.130.88 and port 3260 -w tcpdump.pcap</code><br><code>tcpdump -l | tee dat</code><br><code>tcpdump -U host 172.16.130.88 and port 3260 -w tcpdump.pcap</code> flush each packet to packet-buffered<br><code>tcpdump host 210.27.48.1 and \ (210.27.48.2 or 210.27.48.3 \)</code><br><code>tcpdump -i eth0 src host hostname</code><br><code>tcpdump -i eth0 dst host hostname</code><br><code>tcpdump -n -e -i eth0 icmp</code><br><code>tcpdump -n -e icmp</code><br><code>tcpdump -n -e arp</code>  </li>
<li><code>telnet 172.16.50.39 3128</code> check port is available or not</li>
<li><code>arp -a</code>  </li>
<li><code>squid -CNd1</code>  </li>
<li><code>traceroute www.baidu.com</code>  display all the route from my host to the website  </li>
</ul>
<h4 id="os"><a href="#os" class="headerlink" title="os"></a>os</h4><ul>
<li>Fedora<br><code>Alt+Tab</code> switch windows<br><code>Alt+` </code>  switch sub-windows<br><code>Win</code> windows key, use to show all application<br><code>Win</code> -&gt; <code>Space</code> , search application  </li>
<li>yum use local repository  <ul>
<li>mount iso file to /mnt/cdrom</li>
<li>modify /etc/yum.repos.d/CentOS-Media.repo, add text “file:///mnt/cdrom/“<br>[c6-media]<br>name=CentOS-$releasever - Media<br>baseurl=file:///media/CentOS/  <pre><code>file:///media/cdrom/  
file:///media/cdrecorder/  
file:///mnt/cdrom/  
</code></pre>gdgcheck=1<br>enabled=1<br>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  </li>
</ul>
</li>
<li><code>yum install XXX -y</code><br><code>yum search XXX</code><br><code>yum remove XXX</code><br><code>yum clean all</code><br><code>yum makecache</code>  </li>
<li>Ubuntu<br>reset root password, press ‘e’ to edit grub boot option, change ‘ro quiet splash’<br>to ‘rw init=/bin/bash’, then login terminal with root, use ‘passwd’ to reset.</li>
<li>Ubuntu remove software<ul>
<li>dpkg –get-selections | grep ‘software-name’</li>
<li>sudo apt-get remove –purge software_name</li>
<li>dpkg -l |grep ^rc|awk ‘{print $2}’ |sudo xargs dpkg -P  </li>
</ul>
</li>
</ul>
<h4 id="vimperator-Firfox-plugin"><a href="#vimperator-Firfox-plugin" class="headerlink" title="vimperator(Firfox plugin)"></a>vimperator(Firfox plugin)</h4><ul>
<li>vimperator<br><code>:help</code>  Open help page<br><code>:helpall</code>  Show all help on one page<br><code>C-[</code>    cancel command mode<br><code>d</code>      close current page<br><code>u</code>      undo close current page<br><code>/</code>      search<br><code>H</code>      Go back in the browser history<br><code>gg</code>     Go to the top of the page<br><code>G</code>      Go to the bottom of the page<br><code>C-f</code>    forward page<br><code>C-b</code>    backward page<br><code>y</code>      Copy the current URL to clipboad<br><code>p</code>      Open the URL from current clipboad contents in current buffer<br><code>P</code>      Open the URL from current clipboad contents in a new tab buffer<br><code>r</code>      Reload current page<br><code>ZZ</code>     Quit and save the session<br><code>C-n</code>    Go to the next buffer<br><code>C-p</code>    Go to the previous buffer<br><code>gi</code>     Go to input field<br><code>g-u</code>    Go to the parent directory<br><code>g-U</code>    Go to the root of the website<br><code>c</code>      Start caret mode.Like normal mode of vim, use <code>h j k l</code> to move, and<br>press <code>v</code> to start visual mode, then press <code>y</code> to copy select text<br><code>gi</code>     Use [count]gi to Focus to the [count]th input field<br><code>C-l</code>    Go to URL editor and select it<br><code>C-t</code>    Open a new tab  </li>
</ul>
<h4 id="program"><a href="#program" class="headerlink" title="program"></a>program</h4><ul>
<li><code>man 2 sys_call_name</code> view system call function description<br><code>man 2 open</code>, <code>man 2 read</code>, <code>man 2 write</code>, <code>man 2 fork</code><br><code>man 3 errno</code> view error number description<br><code>man 3 printf</code><br><code>man ascii</code>  </li>
</ul>
<h4 id="Others"><a href="#Others" class="headerlink" title="Others"></a>Others</h4><ul>
<li><code>vimdiff a.log b.log</code> diff two files<br><code>vim -b file</code> edit binary file, use <code>:%!xxd</code> and <code>:%!xxd -r</code>  </li>
<li><code>diff /tmp/test01 /tmp/test02</code> compare file in two directory<br><code>diff -r /tmp/test01 /tmp/test02</code> compare file in directory and subdirectory<br><code>diff /tmp/test01/1.c /tmp/test02/2.c</code> compare two files  </li>
<li>patch<br><code>diff a.c b.c &gt; c.patch</code><br><code>patch a.c c.patch</code>  </li>
<li><code>vmstat iostat ifstat nload top hexdump od</code><br><code>hexdump -C filename</code> display hex+ASCII of file<br><code>iostat -x 2 5</code><br><code>ipcs</code> show all ipc info<br><code>nload</code> monitor network traffic, use <code>tab</code> key to switch to next interface, and <code>q</code> to quit.  </li>
<li><code>dd if=/dev/zero of=$test_file bs=1M count=$dev_size 2&gt;&gt; $log</code><br><code>dd of=/dev/sdh of=/dev/zero bs=1M count=500 oflag=direct</code> test the real hard disk speed<br><code>dd if=path/Fedora-os.iso of=/dev/sdb</code> install fedora live os to U disk(make<br>sure the mount directory of U disk is /dev/sdb, if not should change the out file directory)  </li>
<li><code>&gt; file.txt</code></li>
<li><code>watch -n 5 command</code></li>
<li><code>chroot .</code></li>
<li><code>date &quot;+%F %R:%S&quot;</code><br><code>date &quot;+%y%m%d%H%M%S&quot;</code><br><code>date +%s</code> print timestamp of current time<br><code>date -d @1420210697</code> translate timestamp to datetime<br><code>date +%s -d&quot;Jan 1, 1970 00:00:01&quot;</code> translate datetime to timestamp   </li>
<li><code>which executefile</code> print directory of executefile<br><code>ldd /usr/bin/executefile</code> print shared library dependencies<br><code>nm /usr/lib64/libXXX.so</code> print interface  </li>
<li><code>cat /proc/uptime | awk -F. &#39;{d=($1/86400);h=($1%86400)/3600;m=($1%3600)/60;s=($1%60);printf(&quot;system had run %d day %d hours %d mins %d secs\n&quot;,d,h,m,s)}&#39;</code></li>
<li><code>fuser -u /home</code><br><code>fuser -v -n tcp 7070</code>  </li>
<li><code>echo 1 &gt; /proc/sys/kernel/sysrq</code> enable sysrq<br><code>echo &quot;b&quot; &gt; /proc/sysrq-trigger</code>  reboot<br><code>echo &quot;o&quot; &gt; /proc/sysrq-trigger</code>  shutdown<br><code>shutdown -h now</code>                 shutdown<br><code>shutdown -h +10</code> shutdown 10 minutes later<br><code>shutdown -h 10:00</code> shutdown at ten clock  </li>
<li><code>dmidecode | more</code>    : view mainboard info<br><code>cat /proc/cpuinfo</code>   : view CPU info<br><code>cat /proc/pci</code>       : view pci info<br><code>lspci</code>              : view PCI info<br><code>cat /proc/meminfo</code>   : view memory info<br><code>fdisk -l</code>            : view disk info<br><code>df</code>                  : view disk space useage<br><code>cat /proc/interrupts</code>: view interrupt request<br><code>dmesg | more</code>        : view device debug message  </li>
<li><code>pdftk *.pdf cat output onelargepdfile.pdf</code> merge pdf to one<br><code>pdftk test.pdf cat 1-3 6-20 22-end output net.pdf</code> cut page 4,5,21 from file<br><code>qpdf --password=1234 --decrypt encrypted.pdf decrypted.pdf</code> decrypt pdf file<br><code>qpdf --decrypt encrypted.pdf decrypted.pdf</code> for empty password   </li>
<li><code>vi -e -s -c &quot;:%s/pattern/string/g&quot; -c &quot;:wq&quot; file</code> execute vi comand in shell</li>
<li>format u disk<br><code>fdisk -l</code>            : find u disk<br><code>umount /dev/sdb1</code>    : umount u disk<br><code>mkfs.vfat /dev/sdb1</code> : format as fat  </li>
<li><code>history -c</code> clean<br><code>history -d offset</code> delete specify command  </li>
<li><code>convert -resize 1024x768 input.svg output.png</code> convert svg to png<br><code>convert file.pdf file.png</code> convert pdf to images(file-XX.png)<br><code>convert *.png file.pdf</code> convert images to one pdf<br><code>convert -fill green -pointsize 40 -draw &#39;text 10,50 &quot;funny day&quot;&#39; foo.png comment.png</code> add text to picture  </li>
<li><code>import foo.png</code> capture a select rectangular  </li>
<li><code>for i in</code>ls<code>; do mv -f $i</code>echo $i | sed ‘s/^………/iscsi/‘<code>; done</code> rename<br>  files, replace the first 5 characters with <code>iscsi</code>  </li>
<li><code>fc-list</code> list fonts  </li>
<li><code>strace -o 1.log -s 1024 -T -tt -p 1234</code> print the system call and time used for process 1234</li>
<li><code>printf</code> format and print data<br><code>printf &#39;%x\n&#39; 1550</code> convert octal value 1550 to hex, output 60e<br><code>printf &#39;%d\n&#39; 0x99</code> convert hex value 0x99 to octal, output 153   </li>
<li><code>echo &quot;51200000/64/3“ |bc -l</code> calculate</li>
<li><code>echo &#39;abc 123dd   3xxx tt&#39; |tr -s &#39;[:space:]&#39; &#39;\n&#39;</code> translate spaces to be line break symbol<br><code>echo &#39;abc 123dT 3xXX tt&#39; |tr &#39;[:upper:]&#39; &#39;[:lower:]&#39;</code><br><code>cat test.md |tr -s &#39;[:space:]&#39; &#39;\n&#39; |tr &#39;[:upper:]&#39; &#39;[:lower:]&#39; |sort |uniq -c| sort -nr |head -10</code><br> find the top hot words for text document.</li>
<li><code>zip -Phq.hzy.zf.xf.hx.l@123 test.zip test</code> zip “test” file to be test.zip using password<br><code>unzip -Phq.hzy.zf.xf.hx.l@123 test.zip</code> unzip zip file with password<br><code>unzip -Z test.zip</code> unzip file without password<br><code>cat abc.zip.00* &gt;abc.zip</code> merge zip files  </li>
<li><code>pkill -9 -t pts/1</code>  </li>
<li><code>setenforce 0</code>  forbid Selinux temporary<br><code>sed -i &#39;s/SELINUX=.*/SELINUX=disabled/g&#39; /etc/selinux/config</code> forbid Selinux, need reboot  </li>
<li><code>kill PID</code><br><code>kill -9 PID</code><br><code>kill -kill PID</code>  </li>
<li><code>vgchange -ay</code>  </li>
<li><code>lsof |grep &#39;/core/messages&#39;</code> find which application open the specify file</li>
<li><code>for x in</code>seq 1 1 10<code>; do ps -eo state,pid,cmd | grep &quot;^D&quot;; echo &quot;----&quot;; sleep 5; done</code><br>print the processes in a “D” state every 5 seconds for 10 intervals </li>
<li><code>echo export LANG=en_US.utf8 &gt;&gt;~/.profile</code>, set lang for os,  and checking with <code>echo $LANG</code> or <code>locale</code></li>
<li><code>gstack threadID</code></li>
<li><code>rm !(*.pdf)</code> remove files except pdf</li>
<li><code>[! -d /temp/test] &amp;&amp; mkdir /tmp/test</code> if folder not exist, create it.</li>
</ul>
<h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="http://coolshell.cn/articles/8619.html" target="_blank" rel="external">你可能不知道的Shell</a></li>
<li><a href="http://ahei.info/bash.htm" target="_blank" rel="external">高效操作Bash</a></li>
<li><a href="http://docs.huihoo.com/homepage/shredderyin/readline.html" target="_blank" rel="external">Bash readline 使用技巧</a></li>
<li><a href="http://floss.zoomquiet.org/item20051011211622-frameset.html" target="_blank" rel="external">Shell大杂烩</a></li>
<li><a href="http://blog.jobbole.com/54425/" target="_blank" rel="external">每个Linux用户都应该知道的命令行技巧</a></li>
<li><a href="http://www.cyberciti.biz/faq/check-network-connection-linux/" target="_blank" rel="external">Check network connection command</a></li>
<li><a href="http://www.thegeekstuff.com/2010/11/50-linux-commands/" target="_blank" rel="external">50 Most Frequently Used UNIX / Linux Commands (With Examples)</a></li>
<li><a href="http://albanianwizard.org/tcpdump-how-to-the-linux-troubleshooter.albanianwizard" target="_blank" rel="external">Tcpdump how to – the linux network troubleshooter</a></li>
<li><a href="http://linux.cn/article-4790-1.html" target="_blank" rel="external">20条Linux命令面试问答</a></li>
<li><a href="http://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html" target="_blank" rel="external">Linux tcpdump命令详解</a></li>
<li><a href="http://blog.csdn.net/aspirationflow/article/details/7694274" target="_blank" rel="external">Nmap扫描原理与用法</a></li>
<li><a href="http://easwy.com/blog/archives/change-rpm-package-installation-directories/" target="_blank" rel="external">Linux使用笔记: 更改RPM包的安装目录</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/01/05/linux-common-command/" data-id="ciqqpe1fn001mnmpv5vrql7og" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/git/">git</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/shell/">shell</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/svn/">svn</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vim/">vim</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-copy-file-with-progress-bar" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/01/04/copy-file-with-progress-bar/" class="article-date">
  <time datetime="2013-01-03T16:00:00.000Z" itemprop="datePublished">2013-01-04</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/01/04/copy-file-with-progress-bar/">Copy file with progress bar</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="Copy-file-with-progress-bar"><a href="#Copy-file-with-progress-bar" class="headerlink" title="Copy file with progress bar"></a>Copy file with progress bar</h4><pre><code>#!/usr/bin/bash

print_bar() {        # print the bar 

    local Count=$1
    local Max=$2
    local Remain=$3
    local Elapsed=$4
    local Speed=$5
    local LenBar=50
    if [ $# -eq 6 ]; then
        LenBar=$6
    fi
    if [ ${Count} -gt ${Max} ]; then
        Count=${Max}
    fi
    local Percent=$(((100*Count)/Max))
    local BarPercent=$(((LenBar*Percent)/100))

    if [ ${Percent} -eq 100 ]; then
        Remain=0
    fi

    local BarProgress=$(for i in $(seq ${BarPercent}); do echo -n &apos;=&apos;; done)
    BarProgress=&quot;${BarProgress:0:${#BarProgress}}&gt;&quot;
    local Nxt=$((LenBar-BarPercent))
    local BarPad=$(for i in $(seq ${Nxt}); do echo -n &apos;.&apos;; done)

    local TElapsed=$(date -u -d @$Elapsed +%Hh%Mm%Ss)
    TElapsed=$(echo ${TElapsed} | sed -e &quot;s/^00h//&quot; -e &quot;s/^00m//&quot;)

    local TRemain=$(date -u -d @$Remain +%Hh%Mm%Ss)
    TRemain=$(echo ${TRemain} | sed -e &quot;s/^00h//&quot; -e &quot;s/^00m//&quot;)

    local larg=$(tput cols)
    if [ ${TimeElapsed} -gt ${TimeDiff} ] &amp;&amp; [ ${EndBar} -eq 0 ] &amp;&amp; [ ${Remain} -gt 0 ]; then        
        local mess0=&quot;[ ${Percent}% ][${BarProgress}${BarPad}] (${Speed}K/s) [ Remain: ${TRemain} Spent: ${TElapsed} ]&quot;
        local mess=&quot; :: ${mess0}&quot;
        local mess1=&quot;${TAB_}${mess0}&quot;
        echo -en &quot;\r${mess1}\033[K&quot;
        if [ ${#mess} -gt ${larg} ]; then
            echo -ne &quot;\r\033[1A&quot; src/lib/progbar
        fi
    else
        echo -en &quot;\r${TAB_}[ ${Percent}% ][${BarProgress}${BarPad}][ Time: ${TElapsed} ]\033[K&quot;
    fi
}

if [ $# -eq 2 ]; then
    cp $1 $2 &amp;
fi

file_size_org=0
file_size_dst=0
file_size_org=$(du $1 | awk &apos;{print $1}&apos;)
#echo org size ${file_size_org}

TimeDiff=10
EndBar=1
TimeStart=$(date +%s)
while [ ${file_size_org} -gt ${file_size_dst} ] &amp;&amp; sleep 1
do
    file_size_dst=$(du $2 | awk &apos;{print $1}&apos;)
    TimeNow=$(date +%s)
    TimeElapsed=$(( TimeNow-TimeStart ))
    Speed=$(( file_size_dst/TimeElapsed ))
    TimeRemain=$(( (file_size_org-file_size_dst)/Speed ))
#    echo dst size ${file_size_dst}
    print_bar ${file_size_dst} ${file_size_org} ${TimeRemain} ${TimeElapsed} ${Speed}
#    print_bar ${BytesLoadNow} ${BytesLoadMax} ${TimeRemain} ${TimeElapsed} ${Speed} ${LenBar}
done
echo
</code></pre><h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="http://sourceforge.net/projects/raider/files/?source=navbar" target="_blank" rel="external">raider: src/lib/progbar</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/01/04/copy-file-with-progress-bar/" data-id="ciqqpe1fj001jnmpv4vphloq8" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/shell/">shell</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-svn-project-revision-monitor-linux" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/12/20/svn-project-revision-monitor-linux/" class="article-date">
  <time datetime="2012-12-19T16:00:00.000Z" itemprop="datePublished">2012-12-20</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/12/20/svn-project-revision-monitor-linux/">SVN project revision monitor on Linux</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Monitor-revision-of-SVN-repository-auto-send-change-log-to-user-by-mail"><a href="#Monitor-revision-of-SVN-repository-auto-send-change-log-to-user-by-mail" class="headerlink" title="Monitor revision of SVN repository, auto send change log to user by mail"></a>Monitor revision of SVN repository, auto send change log to user by mail</h3><p><strong>pmt.sh</strong>  </p>
<pre><code>#!/usr/bin/bash
################################################################################
# 自动获取SVN版更新信息,并发送邮件通知
# 历史记录:
#   2012-12-20    v1.0    Dennis  Create
#   2012-12-21    v1.1    Dennis  增加注释,加入文件存在判断和写日志
#   2012-12-24    v1.2    Dennis  增加log日期注释,加入文件存在判断和写日志
################################################################################

conf_file=/etc/pmt.conf
log_file=/tmp/pmt.log

cur_time=`date &quot;+%F %R:%S&quot;`
echo $cur_time &quot;pmt start&quot; &gt;&gt; $log_file

# 如果配置文件不存在, 退出程序
if [ ! -f $conf_file ]
then
    echo &quot;Not found $conf_file&quot; &gt;&gt; $log_file
    goto _EXIT
fi

# Fields: project#url#revision#mail
# 每行列数目为4,使用#号作为分割符号提取行信息到数组arr 
field_size=4
arr=($(awk -F&apos;#&apos; &apos;{print $1,$2,$3,$4}&apos; $conf_file))

# 以4个元素为一个单位，获取数组大小, 以模仿二维数组
item_size=$[${#arr[@]}/$field_size]

while true 
do
    # 循环二维数组(模仿)
    for ((i=0;i&lt;$item_size;i++))
    do
    {
    index=$[i*$field_size]

    prj=${arr[$[index+0]]}
    url=${arr[$[index+1]]}
    rev_old=${arr[$[index+2]]}
    # 提取最新版本号
    rev_new=$(svn info $url | awk &apos;NR==8{print $NF}&apos;)

    if (( $rev_new &gt; $rev_old ))
    then
        # 更新版本号到数组
        arr[$[index+2]]=$rev_new

        # 提取log信息
        svn log $url -r $rev_new:$rev_old &gt; svn.log

        subject=&quot;[svn monitor]&quot;${arr[$[index+0]]}&quot; update&quot;
        to=${arr[$[index+3]]}

        # 发送邮件通知
        mail -s &quot;$subject&quot; $to &lt; svn.log

        # 修改为最新版本号
        # sed中使用变量要加上单引号
        sed -i &apos;/&apos;$prj&apos;/{s/\(.*#.*#\)[0-9]\+/\1&apos;$rev_new&apos;/}&apos; $conf_file

        cur_time=`date &quot;+%F %R:%S&quot;`
        echo $cur_time &quot;${arr[$[index+0]]} update, mail to $to&quot; &gt;&gt; $log_file
    fi
    }
    done
    sleep 5
done

:_EXIT
cur_time=`date &quot;+%F %R:%S&quot;`
echo $cur_time &quot;pmt exit&quot; &gt;&gt; $log_file
exit 0
</code></pre><p><strong>pmt.conf</strong></p>
<pre><code>project01#http://172.168.1.122/repos/dev/project01#18559#usr01@gmail.com
project02#http://172.168.1.122/repos/dev/project02#18635#usr02@gmail.com
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/12/20/svn-project-revision-monitor-linux/" data-id="ciqqpe1fd001dnmpvvstfore2" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/awk/">awk</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/sed/">sed</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/shell/">shell</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/svn/">svn</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-visual-studio-project-atuo-compile" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/12/17/visual-studio-project-atuo-compile/" class="article-date">
  <time datetime="2012-12-16T16:00:00.000Z" itemprop="datePublished">2012-12-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/12/17/visual-studio-project-atuo-compile/">Viusal studio project auto compile</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Windows-Requirements"><a href="#Windows-Requirements" class="headerlink" title="Windows Requirements"></a>Windows Requirements</h3><pre><code>microsoft visual studio 2005 or newer
subversion 1.7.7 or newer

add the path of command tool &quot;svn&quot; and &quot;devenv&quot; to environment path
</code></pre><h3 id="check-out-project-by-svn"><a href="#check-out-project-by-svn" class="headerlink" title="check out project by svn"></a>check out project by svn</h3><p><code>svn co project_svn_url output_path -r revision</code>  </p>
<p><strong>svn_co.bat</strong>  </p>
<pre><code>@ECHO off&amp;SETlocal enabledelayedexpansion 

REM Useage: svn_co.bat svn_src_url out_path revision log_file

SET func=&quot;check out project&quot;

SET src_url=%1
SET out_path=%2
SET src_rev=%3
SET log_file=%4
SET parameters=%src_url%

IF NOT &quot;%out_path%&quot;==&quot;&quot; SET parameters=!parameters! %out_path%

IF NOT &quot;%src_rev%&quot;==&quot;&quot; SET parameters=!parameters! -r %src_rev%

SET log_file_tmp=NUL
IF NOT &quot;%log_file%&quot;==&quot;&quot; SET log_file_tmp=%log_file%

svn co !parameters!

SET /a ret_code=%ERRORLEVEL%
IF %ret_code% EQU 0 (
    @ECHO svn checkout success
) ELSE (
    @ECHO svn checkout fail
)
</code></pre><h3 id="use-devenv-for-compile"><a href="#use-devenv-for-compile" class="headerlink" title="use devenv for compile"></a>use devenv for compile</h3><p><code>devenv solution_file /build &quot;release|win32&quot;</code>  </p>
<p><strong>compile.bat</strong>  </p>
<pre><code>@ECHO off

REM Useage: compile.bat solution_file

SET sln_file=%1
SET cfg_build=&quot;Release|Win32&quot;

devenv %sln_file% /build %cfg_build%

SET /A retval=%ERRORLEVEL%
EXIT /B %retval%
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/12/17/visual-studio-project-atuo-compile/" data-id="ciqqpe1f7001anmpvtjqzqt0s" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/batch/">batch</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-monitor-hardware-status" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/12/17/monitor-hardware-status/" class="article-date">
  <time datetime="2012-12-16T16:00:00.000Z" itemprop="datePublished">2012-12-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/12/17/monitor-hardware-status/">hardware monitor</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>Most of the motherboard can monitor hardware right now, what they can support is<br>depends on the sensor used. So, if you want to known how monitor, you should<br>get the type of sensor chip. I know supermicro x9scl use Nuvoton NCT6776F  and<br>X8SIL use Winbond W83627DHG-P. Once get this message, you can search the<br>datasheet, and get the method how to do it.</p>
<p>On different operation system, have different method to read/write I/O port. I<br>know <a href="http://www.internals.com/" target="_blank" rel="external">WinIO</a> on windows, IoWrite8/16/32 on Linux.</p>
<p>There is a good open source software “Open Hardware Monitor”, which develop by<br>C# language. It support almost all the motherboard.</p>
<hr>
<h1 id="1-Datasheet-of-chips"><a href="#1-Datasheet-of-chips" class="headerlink" title="1. Datasheet of chips"></a>1. Datasheet of chips</h1><p>Look the access channels on file <a href="http://webshop.atlantikelektronik.de/Mailings/NCT6776F_NCT6776D_Datasheet_V1_2.pdf" target="_blank" rel="external">NCT6776F_NCT6776D_Datasheet_V1_2</a><br> page 275</p>
<pre><code>19.2 ACCESS CHANNELS
There are two different channels to set up/access the GPIO ports. The first one is the indirect access via register
2E/2F (4E/4F, it depends by HEFRAS trapping). The registers can be read / written only when the respective
logical device ID and port number are selected.
</code></pre><p>known that rigister index is 0x2E, and data Input/Output port is 0x2F </p>
<p>On page 54<br>    To program the NCT6776F / NCT6776D configuration registers, the following configuration procedures must be<br>    followed in sequence:<br>    (1). Enter the Extended Function Mode.<br>    (2). Configure the configuration registers.<br>    (3). Exit the Extended Function Mode.</p>
<pre><code>7.1.1 Enter the Extended Function Mode
To place the chip into the Extended Function Mode, two successive writes of 0x87 must be applied to Extended
Function Enable Registers (EFERs, i.e. 2Eh or 4Eh).

7.1.2 Configure the Configuration Registers
The chip selects the Logical Device and activates the desired Logical Devices through Extended Function Index
Register (EFIR) and Extended Function Data Register (EFDR). The EFIR is located at the same address as the
EFER, and the EFDR is located at address (EFIR+1).
First, write the Logical Device Number (i.e. 0x07) to the EFIR and then write the number of the desired Logical
Device to the EFDR. If accessing the Chip (Global) Control Registers, this step is not required.

Secondly, write the address of the desired configuration register within the Logical Device to the EFIR and then
write (or read) the desired configuration register through the EFDR.

7.1.3 Exit the Extended Function Mode
To exit the Extended Function Mode, writing 0xAA to the EFER is required. Once the chip exits the Extended
Function Mode, it is in the normal running mode and is ready to enter the configuration mode.
</code></pre><p>Software Programming Example<br>The following example is written in Intel 8086 assembly language. It assumes that the EFER is located at 2Eh, so<br>the EFIR is located at 2Eh and the EFDR is located at 2Fh. If the HEFRAS (CR[26h] bit 6 showing the value of<br>the strap pin at power on) is set, 2Eh can be directly replaced by 4Eh and 2Fh replaced by 4Fh.<br>This example programs the configuration register F0h (clock source) of logical device 1 (UART A) to the value of<br>3Ch (24MHz). First, one must enter the Extended Function Mode, then setting the Logical Device Number (Index<br>07h) to 01h. Then program index F0h to 3Ch. Finally, exit the Extended Function Mode.</p>
<pre><code>;-----------------------------------------------------
; Enter the Extended Function Mode
;-----------------------------------------------------
MOV DX, 2EH
MOV AL, 87H
OUT DX, AL
OUT DX, AL
;-----------------------------------------------------------------------------
; Configure Logical Device 1, Configuration Register CRF0
;-----------------------------------------------------------------------------
MOV DX, 2EH
MOV AL, 07H
OUT DX, AL
; point to Logical Device Number Reg.
MOV DX, 2FH
MOV AL, 01H
OUT DX, AL
; select Logical Device 1
;
MOV DX, 2EH
MOV AL, F0H
OUT DX, AL
; select CRF0
MOV DX, 2FH
MOV AL, 3CH
OUT DX, AL
; update CRF0 with value 3CH
;-----------------------------------------------
; Exit the Extended Function Mode
;----------------------------------------------
MOV DX, 2EH
MOV AL, AAH
OUT DX, AL
</code></pre><hr>
<h1 id="2-Open-Hardware-Monitor"><a href="#2-Open-Hardware-Monitor" class="headerlink" title="2. Open Hardware Monitor"></a>2. Open Hardware Monitor</h1><p><a href="http://openhardwaremonitor.org/" target="_blank" rel="external">Homepage</a><br><a href="http://code.google.com/p/open-hardware-monitor/" target="_blank" rel="external">source code</a>  </p>
<p>The Open Hardware Monitor is a free open source software that monitors<br>temperature sensors, fan speeds, voltages, load and clock speeds of a computer.  </p>
<p>As below, introduct how to use VC++ to monitor HW status on windows: </p>
<p>1). modify computer.cs，add some interface like GetFanSpeed(). if have problem , look report function .<br>2). set the project properity to output class library.<br>3). Reference <a href="http://matrix207.github.com/2012/09/16/VC++-Use-CSharp-Dll/" target="_blank" rel="external">VC++ use C# DLL</a>  </p>
<h2 id="1-1-Analyze-open-hardware-monitor"><a href="#1-1-Analyze-open-hardware-monitor" class="headerlink" title="1.1 Analyze open-hardware-monitor"></a>1.1 Analyze open-hardware-monitor</h2><p>Use Winbond W83627DHG-P chip as example.  </p>
<p>A description about how to monitor hardware, see this<br><a href="http://www.supermicro.com/support/faqs/faq.cfm?faq=12015" target="_blank" rel="external">http://www.supermicro.com/support/faqs/faq.cfm?faq=12015</a></p>
<pre><code>Question
  I&apos;m trying to access the Winbond 83627DHG-P IO chip on the motherboard X8SIL. 
  We want to use the LMsensor. Do you have the offset codes for the smbus?

Answer
  Bus Type = ISAIO/SMBus
  One W83627DHG-P

  Windbond W83627DHG-P, Slave Address=0x2d (0x5a in 8-Bit format)
  OR IndexReg=A15, DataReg=A16
  =============================================================

  Fan1 Fan Speed, Bank 0, Offset 0x29 RPM = 1350000/8/Data
  Fan2 Fan Speed, Bank 5, Offset 0x53 RPM = 1350000/8/Data
  Fan3 Fan Speed, Bank 0, Offset 0x28 RPM = 1350000/8/Data
  Fan4 Fan Speed, Bank 0, Offset 0x3f RPM = 1350000/8/Data
  Fan5 Fan Speed, Bank 0, Offset 0x2a RPM = 1350000/8/Data

  CPU Voltage, Bank 0, Offset 0x20 Voltage = Data* 0.008
  -12V Voltage, Bank 0, Offset 0x26 Voltage = ((Data*0.008-2.048)/(10./242.))+2.048
  +12V Voltage, Bank 0, Offset 0x21 Voltage = Data* 0.008/ (10./66.2)

  AVCC Voltage, Bank 0, Offset 0x22 Voltage = Data* 0.016
  3.3Vcc Voltage, Bank 0, Offset 0x23 Voltage = Data* 0.016

  DIMM Voltage, Bank 0, Offset 0x24 Voltage = Data* 0.008
  +5V Voltage, Bank 0, Offset 0x25 Voltage = Data* 0.008/ (10./40.)
  +3.3VSb Voltage, Bank 5, Offset 0x50 Voltage = Data* 0.016

  VBAT Voltage, Bank 5, Offset 0x51 Voltage = Data* 0.016

  CPU Temperature, Bank 1, Offset 0x50 Temperature = Data

  System Temperature, Bank 2, Offset 0x50 Temperature = Data

  Chassis Intrusion, Bank 0, Offset 0x42, BitMask 0x10 1 = Bad, 0 = Good
  (Clear Bit: Bank 0, Offset 0x46, BitMask 0x80)

  Power Supply Failure, GP23(From W83627DHG-P) 1 = Good, 0 = Bad
</code></pre><hr>
<h3 id="1-1-1-File-Hardware-LPC-LPCIO-cs"><a href="#1-1-1-File-Hardware-LPC-LPCIO-cs" class="headerlink" title="1.1.1 File: Hardware/LPC/LPCIO.cs"></a>1.1.1 File: Hardware/LPC/LPCIO.cs</h3><p>IO Ports</p>
<pre><code>// I/O Ports
private readonly ushort[] REGISTER_PORTS = new ushort[] { 0x2E, 0x4E };
private readonly ushort[] VALUE_PORTS = new ushort[] { 0x2F, 0x4F };
</code></pre><p>Winbond, Nuvoton, Fintek</p>
<pre><code>private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
private const ushort FINTEK_VENDOR_ID = 0x1934;

private const byte WINBOND_NUVOTON_HARDWARE_MONITOR_LDN = 0x0B;

private const byte F71858_HARDWARE_MONITOR_LDN = 0x02;
private const byte FINTEK_HARDWARE_MONITOR_LDN = 0x04;

private void WinbondNuvotonFintekEnter() {
  Ring0.WriteIoPort(registerPort, 0x87);
  Ring0.WriteIoPort(registerPort, 0x87);
}

private void WinbondNuvotonFintekExit() {
  Ring0.WriteIoPort(registerPort, 0xAA);
}
</code></pre><p>ITE</p>
<pre><code>private const byte IT87_ENVIRONMENT_CONTROLLER_LDN = 0x04;
private const byte IT8705_GPIO_LDN = 0x05;
private const byte IT87XX_GPIO_LDN = 0x07;
private const byte IT87_CHIP_VERSION_REGISTER = 0x22;

private void IT87Enter() {
  Ring0.WriteIoPort(registerPort, 0x87);
  Ring0.WriteIoPort(registerPort, 0x01);
  Ring0.WriteIoPort(registerPort, 0x55);
  Ring0.WriteIoPort(registerPort, 0x55);
}

private void IT87Exit() {
  Ring0.WriteIoPort(registerPort, CONFIGURATION_CONTROL_REGISTER);
  Ring0.WriteIoPort(valuePort, 0x02);
}
</code></pre><p>SMSC</p>
<pre><code>private void SMSCEnter() {
  Ring0.WriteIoPort(registerPort, 0x55);
}

private void SMSCExit() {
  Ring0.WriteIoPort(registerPort, 0xAA);
}
</code></pre><h4 id="How-to-get-value"><a href="#How-to-get-value" class="headerlink" title="How to get value:"></a>How to get value:</h4><p>call ReadByte to get value:  </p>
<pre><code>byte id = ReadByte(CHIP_ID_REGISTER);
byte revision = ReadByte(CHIP_REVISION_REGISTER);
</code></pre><p>look at function ReadByte:</p>
<pre><code>private byte ReadByte(byte register) {
  Ring0.WriteIoPort(registerPort, register);
  return Ring0.ReadIoPort(valuePort);
}
</code></pre><p>first, write register value to registerPort;<br>second, read value from valueport. </p>
<hr>
<h3 id="1-1-2-File-Hardware-LPC-W836XX-cs"><a href="#1-1-2-File-Hardware-LPC-W836XX-cs" class="headerlink" title="1.1.2 File: Hardware/LPC/W836XX.cs"></a>1.1.2 File: Hardware/LPC/W836XX.cs</h3><h4 id="How-to-get-value-1"><a href="#How-to-get-value-1" class="headerlink" title="How to get value:"></a>How to get value:</h4><pre><code>// Hardware Monitor
private const byte ADDRESS_REGISTER_OFFSET = 0x05;
private const byte DATA_REGISTER_OFFSET = 0x06;

// Hardware Monitor Registers
private const byte BANK_SELECT_REGISTER = 0x4E;

private byte ReadByte(byte bank, byte register) {
  Ring0.WriteIoPort(
     (ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
  Ring0.WriteIoPort(
     (ushort)(address + DATA_REGISTER_OFFSET), bank);
  Ring0.WriteIoPort(
     (ushort)(address + ADDRESS_REGISTER_OFFSET), register);
  return Ring0.ReadIoPort(
    (ushort)(address + DATA_REGISTER_OFFSET));
} 
</code></pre><h4 id="What-is-the-value-of-“address”"><a href="#What-is-the-value-of-“address”" class="headerlink" title="What is the value of “address”:"></a>What is the value of “address”:</h4><p>set value by construction</p>
<pre><code>public W836XX(Chip chip, byte revision, ushort address) {
  this.address = address;
  this.revision = revision;
  this.chip = chip;
  ...
}
</code></pre><p>on LPCIO.cs, found the calling code:</p>
<pre><code>private const byte BASE_ADDRESS_REGISTER = 0x60;

ushort address = ReadWord(BASE_ADDRESS_REGISTER);

switch (chip) {
  case Chip.W83627DHG:
  case Chip.W83627DHGP:
  case Chip.W83627EHF:
  case Chip.W83627HF:
  case Chip.W83627THF:
  case Chip.W83667HG:
  case Chip.W83667HGB:
  case Chip.W83687THF:
    superIOs.Add(new W836XX(chip, revision, address));
    break;
  ...
}
</code></pre><h4 id="Get-temperature"><a href="#Get-temperature" class="headerlink" title="Get temperature:"></a>Get temperature:</h4><pre><code>private readonly byte[] TEMPERATURE_REG = new byte[] { 0x50, 0x50, 0x27 };
private readonly byte[] TEMPERATURE_BANK = new byte[] { 1, 2, 0 };

for (int i = 0; i &lt; temperatures.Length; i++) {
  int value = ((sbyte)ReadByte(TEMPERATURE_BANK[i], 
    TEMPERATURE_REG[i])) &lt;&lt; 1;
  if (TEMPERATURE_BANK[i] &gt; 0) 
    value |= ReadByte(TEMPERATURE_BANK[i],
      (byte)(TEMPERATURE_REG[i] + 1)) &gt;&gt; 7;

  float temperature = value / 2.0f;
  if (temperature &lt;= 125 &amp;&amp; temperature &gt;= -55 &amp;&amp; !peciTemperature[i]) {
    temperatures[i] = temperature;
  } else {
    temperatures[i] = null;
  }
}
</code></pre><h4 id="Get-fan-speed"><a href="#Get-fan-speed" class="headerlink" title="Get fan speed:"></a>Get fan speed:</h4><p>call ReadByte(FAN_TACHO_BANK[i], FAN_TACHO_REG[i]) to get speed value to “count”<br>, then set real fan spee to array variable “fans[]“.</p>
<pre><code>private readonly byte[] FAN_TACHO_REG = 
  new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
private readonly byte[] FAN_TACHO_BANK = 
  new byte[] { 0, 0, 0, 0, 5 };       
private readonly byte[] FAN_BIT_REG =
  new byte[] { 0x47, 0x4B, 0x4C, 0x59, 0x5D };
private readonly byte[] FAN_DIV_BIT0 = new byte[] { 36, 38, 30, 8, 10 };
private readonly byte[] FAN_DIV_BIT1 = new byte[] { 37, 39, 31, 9, 11 };
private readonly byte[] FAN_DIV_BIT2 = new byte[] { 5, 6, 7, 23, 15 };


ulong bits = 0;
for (int i = 0; i &lt; FAN_BIT_REG.Length; i++)
    bits = (bits &lt;&lt; 8) | ReadByte(0, FAN_BIT_REG[i]);

ulong newBits = bits;
for (int i = 0; i &lt; fans.Length; i++) {
    int count = ReadByte(FAN_TACHO_BANK[i], FAN_TACHO_REG[i]);

    // assemble fan divisor
    int divisorBits = (int)(
            (((bits &gt;&gt; FAN_DIV_BIT2[i]) &amp; 1) &lt;&lt; 2) |
            (((bits &gt;&gt; FAN_DIV_BIT1[i]) &amp; 1) &lt;&lt; 1) |
            ((bits &gt;&gt; FAN_DIV_BIT0[i]) &amp; 1));
    int divisor = 1 &lt;&lt; divisorBits;

    float value = (count &lt; 0xff) ? 1.35e6f / (count * divisor) : 0;
    fans[i] = value;

    // update fan divisor
    if (count &gt; 192 &amp;&amp; divisorBits &lt; 7) 
        divisorBits++;
    if (count &lt; 96 &amp;&amp; divisorBits &gt; 0)
        divisorBits--;

    newBits = SetBit(newBits, FAN_DIV_BIT2[i], (divisorBits &gt;&gt; 2) &amp; 1);
    newBits = SetBit(newBits, FAN_DIV_BIT1[i], (divisorBits &gt;&gt; 1) &amp; 1);
    newBits = SetBit(newBits, FAN_DIV_BIT0[i], divisorBits &amp; 1);
}
</code></pre><hr>
<h1 id="3-lm-sensors"><a href="#3-lm-sensors" class="headerlink" title="3. lm-sensors"></a>3. lm-sensors</h1><p><strong>Introduction</strong></p>
<ul>
<li><a href="http://www.lm-sensors.org/wiki/Download" target="_blank" rel="external">source code download</a>  </li>
<li><a href="http://www.lm-sensors.org/browser/lm-sensors/trunk/doc/developers" target="_blank" rel="external">developer</a>  </li>
<li><a href="http://blog.csdn.net/zhenwenxian/article/details/5331079" target="_blank" rel="external">Lm_sensors和相关技术介绍</a>  </li>
</ul>
<p><strong>lm-sensors configurations</strong>  </p>
<ul>
<li><a href="http://www.lm-sensors.org/wiki/Configurations/Intel" target="_blank" rel="external">Intel</a></li>
<li><a href="http://www.lm-sensors.org/wiki/Configurations/SuperMicro" target="_blank" rel="external">SuperMicro</a>  </li>
<li><a href="http://www.lm-sensors.org/wiki/Configurations/Gigabyte" target="_blank" rel="external">Gigabyte</a></li>
<li><a href="http://www.lm-sensors.org/wiki/Configurations/Asus" target="_blank" rel="external">Asus</a></li>
<li><a href="http://www.lm-sensors.org/wiki/Configurations" target="_blank" rel="external">more</a>  </li>
</ul>
<p><strong>Install</strong></p>
<p>install: <code>yum install lm_sensors</code><br>monitor: <code>sensors</code>  </p>
<hr>
<h1 id="4-Use-WinIO"><a href="#4-Use-WinIO" class="headerlink" title="4. Use WinIO"></a>4. Use WinIO</h1><h2 id="watchdog"><a href="#watchdog" class="headerlink" title="watchdog"></a>watchdog</h2><p>reset Watchdog timeout</p>
<p>Assembly code:</p>
<pre><code>mov    dx, 2eh
mov    al, 87h
out    dx, al
out    dx, al    ; write 0x87 to port 0x2e twice
mov    al, 07h
out    dx, al    ; set Register 0x07 to Index Port
mov    dx, 2fh
mov    al, 08h
out    dx, al    ; switch to Watchdog control page

mov    dx, 2eh
mov    al, f6h
out    dx, al    ; set Register 0xf6 to Index Port
mov    dx, 2fh
mov    al, ah
out    dx, al    ; write time-out value 0x0A to Data Port

mov    dx, 2eh
mov    al, aah
out    dx, al    ; write 0xaa to port 0x2e once
</code></pre><p>C code:</p>
<pre><code>IoWrite8(0x2E,0x87); //write 0x87 to port 0x2e twice
IoWrite8(0x2E,0x87);
IoWrite8(0x2E,0x07); //set Register 0x07 to Index Port
IoWrite8(0x2F,0x08); //switch to Watchdog control page

IoWrite8(0x2E,0xF6); //set Register 0xf6 to Index Port
IoWrite8(0x2F,0x0A); //write time-out value 0x0A to Data Port

IoWrite8(0x2E,0xAA); //write 0xaa to port 0x2e once
</code></pre><p>Want more, visit my windows watchdog project <a href="https://github.com/matrix207/VC/tree/master/watchdog" target="_blank" rel="external">here</a></p>
<p><a href="http://matrix207.github.com/2012/09/16/winio-sample/" target="_blank" rel="external">WinIO sample</a></p>
<hr>
<h1 id="5-Reference"><a href="#5-Reference" class="headerlink" title="5. Reference:"></a>5. Reference:</h1><ul>
<li><a href="http://www.nuvoton.com/hq/enu/ProductAndSales/ProductLines/CloudAndComputingIC/SuperIO/SuperIOforDesktopandIPC/Documents/W83627DHG-P_W83627DHG-PT.pdf" target="_blank" rel="external">W83627DHG-P W83627DHG-PT NUVOTON LPC I/O</a></li>
<li><a href="http://webshop.atlantikelektronik.de/Mailings/NCT6776F_NCT6776D_Datasheet_V1_2.pdf" target="_blank" rel="external">NCT6776F_NCT6776D_Datasheet_V1_2</a></li>
<li><a href="http://lxr.free-electrons.com/source/drivers/watchdog/w83627hf_wdt.c" target="_blank" rel="external">linux/drivers/watchdog/w83627hf_wdt.c</a></li>
<li><a href="http://lxr.free-electrons.com/source/drivers/watchdog/iTCO_vendor_support.c" target="_blank" rel="external">linux/drivers/watchdog/iTCO_vendor_support.c</a></li>
<li><a href="http://lxr.free-electrons.com/source/drivers/hwmon/w83627ehf.c" target="_blank" rel="external">linux/drivers/hwmon/w83627ehf.c</a></li>
<li><a href="http://bbs.csdn.net/topics/390214041" target="_blank" rel="external">watchdog clear</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/12/17/monitor-hardware-status/" data-id="ciqqpe1f00018nmpvyhjp6yfd" class="article-share-link">Partager</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-svn-project-revision-monitor" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/12/15/svn-project-revision-monitor/" class="article-date">
  <time datetime="2012-12-14T16:00:00.000Z" itemprop="datePublished">2012-12-15</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/12/15/svn-project-revision-monitor/">SVN project revision monitor</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Monitor-revision-change-of-SVN-repository"><a href="#Monitor-revision-change-of-SVN-repository" class="headerlink" title="Monitor revision change of SVN repository"></a>Monitor revision change of SVN repository</h3><p><strong>pmt.bat</strong></p>
<pre><code>@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 功能: 监控SVN版本库项目,发现更新自动发送邮件通知 
:: 工具: 
::            subversion    www.sourceforge.net/projects/win32svn
::            blat        www.blat.net
:: 历史:
::        v1.00    2012-12-12    Dennis    create project
::        v1.01    2012-12-13    Dennis    修改邮件附件发送为文本内容发送 
::                                    增加自动更新配置文件中的版本号 
::        v1.02    2012-12-14    Dennis    增加单件实现
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal enabledelayedexpansion

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: run as a singleton
set &quot;app_title=pmt&quot;
tasklist /v | find &quot;%app_title%&quot;&gt;nul &amp;&amp; goto _EXIT
title %app_title%

:: 切换到批处理文件所在目录 
cd /d %~dp0

set app_log=pmt.log
set log_file=svnlog.txt
set cfg_path=%cd%\conf
set cfg_file=%cfg_path%\*.conf
echo %date% %time% start application &gt;&gt; %app_log%

set /a prj_index=1
for /f &quot;tokens=* delims=&quot; %%i in (&apos;dir /s /b /a-d &quot;%cfg_file%&quot;&apos;) do (
    echo call :_CONF_INFO &quot;%%i&quot; !prj_index! &gt;&gt; %app_log%
    call :_CONF_INFO &quot;%%i&quot; !prj_index!
    set prj_!prj_index!_file=&quot;%%i&quot;
    set /a prj_index+=1
)

set /a prj_count=!prj_index!-1
echo Monitor %prj_count% project &gt;&gt; %app_log%
set /a last_rev=0

set &quot;pmt_mail=example@gmail.com&quot;
set &quot;f=-f %pmt_mail%&quot;
set &quot;c=-charset GBK&quot;
:_CHK_REV
:: Check svn revision
:: Send mail by blat when there exist new revision in svn repository
for /l %%i in (1,1,%prj_count%) do (
    echo call :_SVN_LAST_REV !prj_%%i_url! last_rev &gt;&gt; %app_log%
    call :_SVN_LAST_REV !prj_%%i_url! last_rev
    if !last_rev! GTR !prj_%%i_rev! (
        echo !prj_%%i_url! !last_rev! ^&gt; !prj_%%i_rev!
        set /a prj_%%i_rev+=1
        echo project: !prj_%%i_name! &gt; %log_file%
        echo url    : !prj_%%i_url! &gt;&gt; %log_file%
        svn log !prj_%%i_url! -r !last_rev!:!prj_%%i_rev! &gt;&gt; %log_file%

        echo send mail to !prj_%%i_mail! &gt;&gt; %app_log%

        set &quot;s=-s &quot;[svn monitor] !prj_%%i_name! update&quot;&quot;
        set &quot;t=-t !prj_%%i_mail!&quot;
        blat %log_file% !s! %f% !t! %c%
        set prj_%%i_rev=!last_rev!

        :: 更新配置文件版本号 
        :: sed的组括号为批处理特殊字符,需使用^转义 
        :: 如果不转义, 可以采用call的方式 
        :: call :_UPDATE_REV !prj_%%i_file! !last_rev!
        sed -i &apos;/rev=/{s/\^(rev=\^)[0-9]\+/\1!last_rev!/}&apos; !prj_%%i_file!
    )
)
:: sleep 5 seconds
ping -n 5 127.1 &gt; nul    
goto :_CHK_REV

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::exit
:_EXIT
pause
exit /b 0


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Function

:_CONF_INFO &lt;config file&gt; &lt;project index&gt;
:: Get configure info
:: usebackq 用以解决文件路径中包含空格的情况 
FOR /F &quot;usebackq tokens=1,2* delims==&quot; %%i in (%1) do (
    set &quot;prj_%2_%%i=%%j&quot;
)
GOTO :EOF

:_SVN_LAST_REV &lt;url&gt; [retvar]
:: Get lastest revision
for /f &quot;skip=7 delims=: tokens=2&quot; %%i in (&apos;svn info %1&apos;) do (
    (if %2. neq . (set/a%2=%%i)else echo %%i)&amp;goto :eof
)
GOTO :EOF

REM :_UPDATE_REV &lt;file&gt; &lt;revision&gt;
REM :: Update revision
REM sed -i &apos;/rev=/{s/\(rev=\)[0-9]\+/\1%2/}&apos; %1
REM GOTO :EOF
</code></pre><p><strong>example.conf</strong></p>
<pre><code>name=example_project
url=http://172.168.1.122/repos/dev/example_project/trunk
rev=15793
mail=user@gmail.com,abc@yahoo.com,test@hotmail.com
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/12/15/svn-project-revision-monitor/" data-id="ciqqpe1ey0015nmpvzutmcwnb" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/batch/">batch</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-send-mail-by-blat" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/12/15/send-mail-by-blat/" class="article-date">
  <time datetime="2012-12-14T16:00:00.000Z" itemprop="datePublished">2012-12-15</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/12/15/send-mail-by-blat/">Send mail use blat</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="What-is-blat"><a href="#What-is-blat" class="headerlink" title="What is blat?"></a>What is blat?</h4><p>Blat is a Windows (32 &amp; 64 bit) command line utility that sends eMail using SMTP or post to usenet using NNTP.  </p>
<p>Home: <a href="www.blat.net">www.blat.net</a><br>syntax: <a href="www.blat.net/syntax/syntax.html">www.blat.net/syntax/syntax.html</a><br>ref: <a href="www.cybergav.in/2010/10/28/how-to-send-emails-using-blat/">how to send emails using blat</a>  </p>
<h4 id="Installation"><a href="#Installation" class="headerlink" title="Installation"></a>Installation</h4><p><code>blat -installSMTP smtp.gmail.com abc@gmail.com -u username -pw yourpasswd</code></p>
<h4 id="Send-mail"><a href="#Send-mail" class="headerlink" title="Send mail"></a>Send mail</h4><p><code>blat -s &quot;blat mail&quot; -to test@gmail.com -f abc@gmail.com -body&quot;test body&quot;</code></p>
<h4 id="Send-email-with-body-from-a-file"><a href="#Send-email-with-body-from-a-file" class="headerlink" title="Send email with body from a file"></a>Send email with body from a file</h4><p><code>blat test.txt -s &quot;blat mail&quot; -to test@gmail.com -f abc@gmail.com</code></p>
<h4 id="specify-charset-of-body-file"><a href="#specify-charset-of-body-file" class="headerlink" title="specify charset of body file"></a>specify charset of body file</h4><p><code>blat utf8.txt -s &quot;blat mail&quot; -to test@gmail.com -f abc@gmail.com -charset GBK</code></p>
<h4 id="Send-attachment"><a href="#Send-attachment" class="headerlink" title="Send attachment"></a>Send attachment</h4><p><code>blat -s &quot;blat mail&quot; -to test@gmail.com -f abc@gmail.com -body&quot;test attach&quot; -attach 1.txt</code></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/12/15/send-mail-by-blat/" data-id="ciqqpe1eu0012nmpvqwx7udnc" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/batch/">batch</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-visual-studio-project-clean" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/12/14/visual-studio-project-clean/" class="article-date">
  <time datetime="2012-12-13T16:00:00.000Z" itemprop="datePublished">2012-12-14</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/12/14/visual-studio-project-clean/">Visual studio project clean</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Clean-visual-studio-project"><a href="#Clean-visual-studio-project" class="headerlink" title="Clean visual studio project"></a>Clean visual studio project</h3><pre><code>@ECHO off
setlocal enabledelayedexpansion
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Clean Visual studio project
:: Dennis
:: 2012-12-14
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:_LOOP
cls
set &quot;prj_path=&quot;
set /p prj_path=Drag project folder here:
if !prj_path!. EQU . goto _EXIT
cd !prj_path!

del *.suo Thumbs.db /f /s /a:h 2&gt;nul
del *.ncb *.user /f /s 2&gt;nul

set /a del_type=1
set /p del_type=Option 1 delete files,2 remove folder(default 1):
if %del_type% GEQ 1 (
    if %del_type% LEQ 2 goto _DEL_TYPE_%del_type%
)
echo Please check your choise, only 1 and 2 is available.
pause
goto _LOOP

:_DEL_TYPE_1
del *.aps *.plg *.bsc *.hpj *.clw *.map *.exp *.cbp *.mdp *.ilk /f /s 2&gt;nul
del *.sbr *.res *.obj *.pch *.pdb *.idb *.tmp *.opt mt.dep /f /s 2&gt;nul
del *.manifest BuildLog.htm /f /s 2&gt;nul
pause
goto _LOOP

:_DEL_TYPE_2
::使用*号做分隔符,解决路径中出现空格导致无法获取完整路径问题 
@for /f &quot;delims=*&quot; %%i in (&apos;dir /s /b /ad&apos;) do (
    if /i &quot;%%~ni&quot;==&quot;debug&quot; rmdir /s /q &quot;%%i&quot;
    if /i &quot;%%~ni&quot;==&quot;release&quot; rmdir /s /q &quot;%%i&quot;
)

pause
goto _LOOP

:_EXIT
pause&amp;exit /B 0
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/12/14/visual-studio-project-clean/" data-id="ciqqpe1er000znmpv6k95c885" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/batch/">batch</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/page/16/">&laquo; __('prev')</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/15/">15</a><a class="page-number" href="/page/16/">16</a><span class="page-number current">17</span><a class="page-number" href="/page/18/">18</a><a class="extend next" rel="next" href="/page/18/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>